import { BasicResult } from '#/http';
import request from '@/http/request';

export type LoginRequest = {
  username: string;
  password: string;
};

export type LoginResponse = {
  username: string;
  accessToken: string;
  roles: string[];
};

export type RefresLoginRequest = {
  accessToken: string;
};

export const getProject = async (data: LoginRequest) => {
  return request.post<LoginRequest, BasicResult<LoginResponse>>('/project', data);
};

export const refresUserInfo = async (data: RefresLoginRequest) => {
  return request.post<RefresLoginRequest, BasicResult<LoginResponse>>('/getUserInfo', data);
};
